<?php namespace App\Core\Repository\Criterias;

use App\Core\Repository\Criteria;
use App\Core\Repository\Repository;

class NotDeleteCriteria extends Criteria {
    
    protected $field;
    protected $normalValue;
    
    public function __construct($field = 'is_delete', $normalValue = '0') {
        $this->field = $field;
        $this->normalValue = $normalValue;
    }

    public function apply(Repository $repository){
        parent::apply($repository);
        $this->query->where($this->formatField($this->model, $this->field), '=', $this->normalValue);
    }
}